<!--商品详情-->
<template>
	<div class="w store-content">
		<div class="search-box">
			<search class="search-dom"></search>
		</div>
	    <div class="nav-subs">
	      <div class="nav-sub-bgs"></div>
	      <div class="nav-sub-wrappers">
	        <div class="w">
	          <ul class="nav-lists">
	            <li>
	              <router-link to="/">
	                <a>首页</a>
	              </router-link>
	            </li>
	            <li>
            		<router-link to="/game">
	               		<a>游戏专区</a>
              		</router-link>
	            </li>
 			  	<li>
 			  		<router-link to="/item">
	               		<a class="active">账号图文详情</a>
            </router-link>
	            </li>
	          </ul>
	        </div>
	      </div>
	    </div>

		<div class="gray-box">
			<div class="gallery-wrapper">
				<div class="gallery">
					<div class="thumbnail">
						<ul>
							<li v-for="(item,i) in small" :key="i" :class="{on:big===item}" @click="big=item">
								<img v-lazy="item" :alt="product.name">
							</li>
						</ul>
					</div>
					<div class="thumb">
						<div class="big">
							<img :src="big" :alt="product.name">
						</div>
					</div>
				</div>
			</div>
			<!--右边-->
			<div class="banner">
				<div class="sku-custom-title">
					<h4>{{product.name}}</h4>
					<h6>
            <span class="price">
              <em>¥</em><i>{{Number(product.price).toFixed(2)}}</i></span>
          </h6>
				</div>
				<!-- 选择规格 -->
				<div class="item-select">
					<div class="item-select-title">
						<p class="i-title">商品编号：</p>
						<p class="i-value">{{product.id}}</p>
					</div>
					<div class="item-select-title">
						<p class="i-title">游戏分类：</p>
						<p class="i-value">{{product.productCategoryName}}</p>
					</div>
          <div class="item-select-title">
            <p class="i-title">游戏大区：</p>
            <p class="i-value">{{product.gameGroup}} - {{product.gameServer}}</p>
          </div>
          <div class="item-select-title">
            <p class="i-title">浏览次数：</p>
            <p class="i-value">{{product.hit}}</p>
          </div>
          <div class="item-select-title">
            <p class="i-title">商品状态：</p>
            <p class="i-value_status" v-for="status in goodStatus">{{status}}</p>
          </div>
				</div>
				<div class="item-btn-box">
					<button class="item-btn" @click="callQQService(qqCharNum)">在线客服</button>
					<!--<button class="item-btn" @click="callWecharService(WeCharNum)">联系微信客服</button>-->
          <!--<button class="item-btn" @click="callQYWXService(qyCharNum)">企业微信客服</button>-->
					<input type="text" style="width: 0.5px;" id="wecharNum" v-model="WeCharNum"/>

          <!--<div class="item-select-title1" v-if="qyCharNum !=''">-->
             <!--<div class="i-title-all">❤❤企业微信-扫码添加❤❤-->
             <!--<br/>-->
               <!--<img  src ="/static/images/66ffb013effa8329116fa8cb51845a4.png" class="item-btn-img" alt="请扫码添加企业微信"/>-->
             <!--</div>-->

          <!--</div>-->

				</div>

        <!--<div class="item-select-title">-->
          <!--<p class="i-title-all">❤❤可购买2.5倍赔付❤❤:<a href="https://5u258.com/notice" target="_blank">《平台收费项目、收费标准》 </a></p><br/>-->
        <!--</div>-->
        <!--<div class="item-select-title">-->
          <!--<p class="i-title-all">❤❤买号找我:<a class="link-btn" target="_blank" :href="'http://wpa.qq.com/msgrd?v=3&uin=2059151356&site=qq&menu=yes'">QQ:2059151356</a></p>-->
        <!--</div>-->
			</div>
		</div>
		<!--产品信息-->
    <div class="item-info-buy">
      <y-shelf title="购买流程">
        <div slot="content">
          <div class="no-info-buy">
            <img src="/static/images/goumailiucheng.jpg">
          </div>
        </div>
      </y-shelf>
    </div>
		<div class="item-info">
			<y-shelf title="账号图文详情">
				<div slot="content">
					<div class="img-item" v-if="productMsg">
						<div v-html="productMsg" v-lazy-container="{ selector: 'img'}">{{ productMsg }}</div>
					</div>
					<div class="no-info" v-else>
						<img src="/static/images/no-data.png">
						<br> 该商品暂无内容数据
					</div>
				</div>
			</y-shelf>
		</div>
		<right-nav></right-nav>
	</div>
</template>
<script>
  import {getContactInfo, productDet} from '/api/goods'
  //	import { currency } from '/api/utils'
  import {mapMutations, mapState} from 'vuex'
  import YShelf from '/components/shelf'
  import rightNav from '/components/rightNav'
  import search from '/components/searchBox'
  import {getStore} from '/utils/storage'

  export default {
	  name:'async',
    metaInfo (){
      return {
        title: this.productCategoryName + '游戏账号出售-账号交易首选无忧-账号找回永久包赔-所售账号不转手永久包赔', // set a title
         meta: [{
          name: 'keywords',
          content: '5u，5u账号，5u258，wuyouzhanghao，5u游戏，游戏账号交易，无忧账号，游戏帐号交易平台,5u258交易平台，5u258官网，王者荣耀，CF枪战之王，火影忍者，QQ飞车手游，和平精英，穿越火线，英雄联盟，逆战，霸气玩，租号玩，买卖账号'
        },{
          name: 'description',
          content: '详情￥'+this.price+' 游戏大区:'+this.gameGroup+' 游戏区服:'+this.gameServer+' '+this.gameDesc
        }]
      }
    },
		data() {
			return {
				productMsg: {},
				selectBoxIndex: 0,
				small: [],
				big: '',
				product: {
					salePrice: 0
				},
				userId: '',
				curLocation: '',
				WeCharNum:'',
        qqCharNum:'',
        qyCharNum:'',//企业微信
        gameDesc: '',
        productCategoryName: '',
        goodStatus:[],//商品状态
        gameGroup: '', //游戏大区
        price: '',//价格
        gameServer: '',//游戏区服
			}
		},
		computed: {
			...mapState(['login', 'showMoveImg','navIndex'])
		},
		methods: {
			...mapMutations(['CHANGE_NAV']),
				_productDet(id) {
				productDet({
					id: id
				}).then(res => {
					let result = res.data;
					this.product = result.goods.goods;
					let contentHTML = this.product.detailHtml.replace(/src/g,'data-src');
          this.productMsg = contentHTML || '';
					var subImages = this.product.albumPics;
					this.small = subImages.split('&$$$&');
					this.big = this.small[0];
					this.gameDesc = this.product.name;//游戏描述
          this.productCategoryName = this.product.productCategoryName;//游戏名称
          this.price = Number(this.product.price).toFixed(2);
          this.gameGroup = this.product.gameGroup;
          this.gameServer = this.product.gameServer;

          // 出售状态
          var verfiyStatus = this.product.verifyStatus;
          if (verfiyStatus=='0'){
            this.goodStatus.push('账号未审核 ');
          }else if ( verfiyStatus=='1'){
            this.goodStatus.push('官方已审核通过 ');
          }

          var pubStatus = this.product.publishStatus;
          if (pubStatus && pubStatus=='0'){
            this.goodStatus = [];
            this.goodStatus.push('账号已被官方下架');
          }else  if (pubStatus && pubStatus=='1'){
            this.goodStatus.push('账号出售中');
          }

          var delStatus = this.product.deleteStatus;
          if (delStatus=='0'){
            // this.goodStatus.push('未删除');
          }else if ( delStatus=='1'){
            this.goodStatus = [];
            this.goodStatus.push('账号已售');
          }
          // console.log(this.gameDesc)
				}).catch((e) => {
					console.log(e)
				});
			},
			callQQService(item) {
				var aa = document.createElement("a");
				aa.target="_blank";
        if (item.length > 15) {//长度超过15位，认为是53KF
          aa.href = "https://tb.53kf.com/code/worker/4d9fb00898116e00c85b2a6cdd05494d0/11079541";
        } else {
          aa.href = "http://wpa.qq.com/msgrd?v=3&uin=" + item + "&site=qq&menu=yes";
        }

				aa.click();
			},
			callWecharService(item) {
				var mes = "已复制官方微信   "+item+ "  ,请在微信里面添加客服好友";
				var wecharNumDom = document.getElementById("wecharNum");
				wecharNumDom.select();
				document.execCommand("Copy");
		        this.$alert(mes, '无忧账号-官方认证微信号', {
		          confirmButtonText: '确定',
		          callback: action => {
		            this.$message({
		              type: 'info',
		              message: `action: ${ action }`
		            });
		          }
		        });
			},
      callQYWXService(item) {
        var img = document.createElement("img");
        img.src="";
        img.click();

        this.$alert("", '官方认证企业微信-扫码添加', {
          confirmButtonText: '确定',
          callback: action => {
            this.$message({
              type: 'info',
              message: `action: ${ action }`
            });
          }
        });
      },
      // 获取联系方式
      getWxChatContactList() {
        getContactInfo({isMain:1,sellerOrBuyer:'buyer',type:'WECHAT'}).then(response => {
          this.WeCharNum = response.data.contact;
        });
      },
      getQqContactList() {
        getContactInfo({isMain: 1, sellerOrBuyer: 'buyer', type: 'QQ'}).then(response => {
          this.qqCharNum = response.data.contact;
        });
      },
      getqyWecharContactList() {
        getContactInfo({isMain: 1, sellerOrBuyer: 'qywx', type: 'QY'}).then(response => {
          this.qyCharNum = response.data.contact;
        });
      },
		},
		created() {
      this.getWxChatContactList();
      this.getQqContactList();
      this.getqyWecharContactList();
			let id = this.$route.query.id
			this._productDet(id);
			this.userId = getStore('userId');
			this.CHANGE_NAV(1);
		},
		filters: {
//			currency: currency
		},
		components: {
			YShelf,
			search,
			rightNav
		}
	}
</script>
<style lang="scss" scoped>
	@import "../../assets/style/mixin";
  .nav-subs {
    position: relative;
    z-index: 20;
    height: 60px;
    background: #f7f7f7;
    box-shadow: 0 2px 4px rgba(0, 0, 0, .04);
    .nav-sub-wrappers{
      padding: 20px 0;
      height: 50px;
      position: relative;
    }
    .w {
      display: flex;
      justify-content: space-between;
    }
    .nav-lists {
      height: 28px;
      line-height: 28px;
      display: flex;
      align-items: center;
      height: 100%;
      li:first-child {
        padding-left: 0;
        a {
          padding-left: 10px;
        }
      }
      li {
        position: relative;
        float: left;
        padding-left: 2px;
        a {
          display: block;
          // cursor: default;
          padding: 0 10px;
          color: #666;
          &.active {
            font-weight: bold;
          	color: #FF8700;
          }
        }
        a:hover {
          color: #FF8700;
        }
      }
      li:before {
        content: ' ';
        position: absolute;
        left: 0;
        top: 13px;
        width: 2px;
        height: 2px;
        background: #bdbdbd;
      }
    }
  }

	.store-content {
		clear: both;
		width: 1100px;
		min-height: 600px;
		padding: 0 0 25px;
		margin: 20px auto;
	}

	.search-box {
		width: 100%;
		height: 90px;
		position: relative;
		margin-top: 30px;
	}
	.search-dom{
		position: relative;
		width: 80%;
		float: right;
		right: 0;

	}

	.gray-box {
		display: flex;
		padding: 60px;
		margin: 20px 0;
		.gallery-wrapper {
			.gallery {
				display: flex;
				width: 540px;
				.thumbnail {
					li:first-child {
						margin-top: 0px;
					}
					li {
						@include wh(80px);
						margin-top: 10px;
						padding: 12px;
						border: 1px solid #f0f0f0;
						border: 1px solid rgba(0, 0, 0, .06);
						border-radius: 5px;
						cursor: pointer;
						&.on {
							padding: 10px;
							border: 3px solid #ccc;
							border: 3px solid rgba(0, 0, 0, .2);
						}
						img {
							display: block;
							@include wh(100%);
						}
					}
				}
				.thumb {
					.big {
						margin-left: 20px;
					}
					img {
						display: block;
						@include wh(440px)
					}
				}
			}
		}
		// 右边
		.banner {
			width: 450px;
			margin-left: 10px;
      /*height: 786px;*/
			h4 {
				font-size: 18px;
				line-height: 1.25;
				color: #000;
				margin-bottom: 13px;
			}
			h6 {
				font-size: 14px;
				line-height: 1.5;
				color: #bdbdbd;
				display: flex;
				align-items: center;
				justify-content: space-between;
			}
			.sku-custom-title {
				overflow: hidden;
				padding: 8px 8px 18px 10px;
				position: relative;
			}
			.params-name {
				padding-right: 20px;
				font-size: 14px;
				color: #8d8d8d;
				line-height: 36px;
			}
		}
	}

	.item-info {
		.gray-box{
			padding: 0;
			display: block;
		}
		.img-item {
			width: 1220px;
			/*padding: 1vw;*/
			text-align: center;
			img {
				width: 100%;
				height: auto;
				display: block;
			}
		}
	}

  .item-info-buy {
    .gray-box{
      padding: 0;
      display: block;
    }
    .img-item {
      width: 1220px;
      /*padding: 1vw;*/
      text-align: center;
      img {
        width: 100%;
        height: 10%;
        display: block;
      }
    }
  }
	.img-item /deep/ p{
		width: 98%;
	}
	.img-item /deep/ /deep/ .wscnph{
		width: 99%;
	}
	.i-title {
		width: 20%;
		height: 100%;
	}
  .i-title-all {
    width: 100%;
    /*height: 100%;*/
    white-space:normal;
    word-break:break-all;
    word-wrap:break-word;

  }

	.i-value {
		width: 50%;
		height: 100%;
		color: black;
	}

  .i-value_status {
    width: 27%;
    height: 100%;
    color: black;
  }

	.no-info {
		padding: 200px 0;
		text-align: center;
		font-size: 30px;
	}
  .no-info-buy {
    padding: 5px 0;
    text-align: center;
    font-size: 30px;
  }

	.price {
		display: block;
		color: #d44d44;
		font-weight: 700;
		font-size: 16px;
		line-height: 20px;
		text-align: right;
		margin-top: 20px;
		margin-left: 20px;
		i {
			padding-left: 2px;
			font-size: 24px;
		}
	}

	.item-select {
		border-bottom: 1px solid #E5E5E5;
		margin-left: 20px;
	}

	.item-select-title {
		height: 40px;
		display: flex;
		padding-left: 20px;
	}

  .item-select-title1 {
    height: 40px;
    display: flex;
    padding-top: 20px;
    padding-left: 20px;
    color:orangered;
  }

	.item-btn-box {
		width: 130%;
		height: 50px;
		margin-top: 20px;
	}

  .item-btn-img {
    width: 150px;
    height: 158px;
    margin-top: 20px;
    padding-bottom: 36px;
  }

	.item-btn {
		width: 120px;
		height: 80%;
		margin-left: 40px;
		border-radius: 5px;
		background-color: #FF8700;
		color: white;
		cursor: pointer;
	}
	@media (max-width: 1340px) {
		body {
			min-width: 1340px;
		}
		.store-content {
			width: 1000px;
		}
		.search-box {
			right: 0;
			width: 100%;
		}
	}
  .img-item /deep/ /deep/ .wscnph[lazy="error"]{
    display:block;
    width:0px !important;
    height:0px !important;
    margin:0 auto;height: 660px;
  }

	@media (min-width: 1700px) {
		body {
			min-width: 1470px;
		}
		.store-content {
			width: 1200px;
		}
	}
</style>
